// -*- IDL -*-

/**
 * @file IFR_Extended.pidl
 *
 *   This file is used to generate the code in IFR_ExtendedC.{h,i,cpp}.
 *   The original file Interface.idl was split into four pieces, to
 *   keep the generated files to a manageable size and reduce build
 *   time. This IDL file contains all the interfaces and other data
 *   types related to fixed types and valuetypes.
 */

#ifndef _IFR_EXTENDED_IDL_
#define _IFR_EXTENDED_IDL_

#include "tao/IFR_Client/IFR_Basic.pidl"
#include "tao/AnyTypeCode/Visibility.pidl"
#include "tao/AnyTypeCode/ValueModifier.pidl"

module CORBA
{
  typeprefix CORBA "omg.org";

// Already defined in other files, included above
/*
  typedef short ValueModifier;
  const ValueModifier VM_NONE = 0;
  const ValueModifier VM_CUSTOM = 1;
  const ValueModifier VM_ABSTRACT = 2;
  const ValueModifier VM_TRUNCATABLE = 3;

  typedef short Visibility;
  const Visibility PRIVATE_MEMBER = 0;
  const Visibility PUBLIC_MEMBER = 1;
*/
  interface FixedDef : IDLType
  {
    attribute unsigned short digits;
    attribute short scale;
  };

  struct ValueMember
  {
    Identifier name;
    RepositoryId id;
    RepositoryId defined_in;
    VersionSpec version;
    TypeCode type;
    IDLType type_def;
    Visibility access;
  };

  typedef sequence <ValueMember> ValueMemberSeq;

  interface ValueMemberDef : Contained
  {
    readonly attribute TypeCode type;
    attribute IDLType type_def;
    attribute Visibility access;
  };

  interface ValueDef : Container, Contained, IDLType
  {
    // read/write interface
    attribute InterfaceDefSeq supported_interfaces;
    attribute InitializerSeq initializers;
    attribute ValueDef base_value;
    attribute ValueDefSeq abstract_base_values;
    // read interface
    attribute boolean is_abstract;
    attribute boolean is_custom;
    attribute boolean is_truncatable;
    boolean is_a (
        in RepositoryId id
      );

    struct FullValueDescription
    {
      Identifier name;
      RepositoryId id;
      boolean is_abstract;
      boolean is_custom;
      RepositoryId defined_in;
      VersionSpec version;
      OpDescriptionSeq operations;
      AttrDescriptionSeq attributes;
      ValueMemberSeq members;
      InitializerSeq initializers;
      RepositoryIdSeq supported_interfaces;
      RepositoryIdSeq abstract_base_values;
      boolean is_truncatable;
      RepositoryId base_value;
      TypeCode type;
    };

    FullValueDescription describe_value ();

    ValueMemberDef create_value_member  (
        in RepositoryId id,
        in Identifier name,
        in VersionSpec version,
        in IDLType type,
        in Visibility access
      );
    AttributeDef create_attribute (
        in RepositoryId id,
        in Identifier name,
        in VersionSpec version,
        in IDLType type,
        in AttributeMode mode
      );
    OperationDef create_operation (
        in RepositoryId id,
        in Identifier name,
        in VersionSpec version,
        in IDLType result,
        in OperationMode mode,
        in ParDescriptionSeq params,
        in ExceptionDefSeq exceptions,
        in ContextIdSeq contexts
      );
  };

  struct ValueDescription
  {
    Identifier name;
    RepositoryId id;
    boolean is_abstract;
    boolean is_custom;
    RepositoryId defined_in;
    VersionSpec version;
    RepositoryIdSeq supported_interfaces;
    RepositoryIdSeq abstract_base_values;
    boolean is_truncatable;
    RepositoryId base_value;
  };

  interface ExtValueDef : ValueDef
  {
    // read/write interface
    attribute ExtInitializerSeq ext_initializers;

    // read interface
    struct ExtFullValueDescription
    {
      Identifier name;
      RepositoryId id;
      boolean is_abstract;
      boolean is_custom;
      RepositoryId defined_in;
      VersionSpec version;
      OpDescriptionSeq operations;
      ExtAttrDescriptionSeq attributes;
      ValueMemberSeq members;
      ExtInitializerSeq initializers;
      RepositoryIdSeq supported_interfaces;
      RepositoryIdSeq abstract_base_values;
      boolean is_truncatable;
      RepositoryId base_value;
      TypeCode type;
    };

    ExtFullValueDescription describe_ext_value ();

    // write interface
    ExtAttributeDef create_ext_attribute ( in RepositoryId id,
                                           in Identifier name,
                                           in VersionSpec version,
                                           in IDLType type,
                                           in AttributeMode mode,
                                           in ExceptionDefSeq get_exceptions,
                                           in ExceptionDefSeq set_exceptions
      );
  };

  interface ValueBoxDef : TypedefDef
  {
    attribute IDLType original_type_def;
  };
};

#endif /* _IFR_EXTENDED_IDL_ */
